﻿using System;
using Atomic.Common;
using Atomic.Db;
using Atomic.Permission.Entities;
using System.Linq.Expressions;
namespace Atomic.Permission
{
    public interface IRole : IError
    {
        /// <summary>
        /// 新建角色
        /// </summary>
        /// <param name="entity">角色信息</param>
        /// <returns>是否新建成功</returns>
        bool Add(RoleEntity entity);

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="id">角色Id</param>
        /// <returns>删除是否成功</returns>
        bool Remove(int id);

        /// <summary>
        /// 更新角色信息
        /// </summary>
        /// <param name="entity">角色信息</param>
        /// <param name="id">角色ID</param>
        /// <returns>是否更新成功</returns>
        bool Update(RoleEntity entity, int id);

        /// <summary>
        /// 按角色ID查询角色信息
        /// </summary>
        /// <param name="id">角色ID</param>
        /// <returns></returns>
        RoleEntity Get(int id);

        /// <summary>
        /// 分页查询角色列表
        /// </summary>
        /// <param name="pager">分页参数</param>
        /// <param name="predicate">筛选条件</param>
        /// <returns>角色分页数据</returns>
        Pager<RoleEntity> GetPager(Pager pager, Expression<Func<RoleEntity, bool>> predicate = null);


    }
}
